<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/css/bootstrap-theme.min.css">
    <title>admin management</title>
</head>

<body>
    <!--顶部导航-->
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <div class="navbar-header">
                <a class="navbar-brand" href="/admin">后台管理</a>
            </div>

            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li><a href="/admin/user">用户管理</a></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">分类管理 <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="/admin/category">分类首页</a></li>
                            <li><a href="/admin/category/add">添加分类</a></li>
                        </ul>
                    </li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">内容管理 <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="/admin/article">内容首页</a></li>
                            <li><a href="/admin/article/add">添加内容</a></li>
                        </ul>
                    </li>
                </ul>

                <ul class="nav navbar-nav navbar-right">
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><%= user.username %> <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            <li><a href="#">退出</a></li>
                        </ul>
                    </li>
                </ul>
            </div>
        </div>
    </nav>

    <div class="container-fluid">
        <ol class="breadcrumb">
            <li><a href="/admin">管理首页</a></li>
            <li><span>内容修改</span></li>
        </ol>

        <h3>内容修改 - <%= article.title %></h3>

        <form role="form" method="post" action="/admin/article/edit/<%= article.id %>">
            <div class="form-group">
                <label for="title">分类：</label>
                <select name="category" id="category" class="form-control">
                    <% for(var category of categories){ %>
                        <% if(article.category._id.toString() == category._id.toString()){ %>
                            <option value="<%= category.id %>" selected><%= category.name %></option>
                        <% }else{ %>
                            <option value="<%= category.id %>"><%= category.name %></option>
                        <% } %>
                    <% } %>
                </select>
            </div>

            <div class="form-group">
                <label for="title">标题：</label>
                <input type="text" value="<%= article.title %>" class="form-control" id="title" placeholder="请输入内容标题" name="title">
            </div>

            <div class="form-group">
                <label for="description">简介：</label>
                <textarea name="description" id="description" class="form-control" rows="5" placeholder="请输入内容简介"><%= article.description %></textarea>
            </div>

            <div class="form-group">
                <label for="content">内容：</label>
                <textarea name="content" id="content" class="form-control" rows="10" placeholder="请输入内容"><%= article.content %></textarea>
            </div>

            <button type="submit" class="btn btn-default">提交</button>
        </form>
    </div>
</body>
<script src="/lib/jquery-1.12.4.min.js"></script>
<script src="/lib/bootstrap.min.js"></script>

</html>
